<?php
class readController extends  appController{
	public function index(){
		$this->assign("card_number",Model('read')->get_cfg("card_number"));
		$this->assign("res", Model('read')->get_record());
		$this->display("index.html");
	}
	
	public function save_card_number(){
		$info['card_number'] = isset($_POST['card_number'])?$_POST['card_number']:'';
		if(Model('chat')->saveConfig($info)){
			$result['error'] = 0;
			$result['content'] = Lang('VALID_OPERATION');
		}else{
			$result['content'] = Lang('INVALID_OPERATION');
		}
		$this->showMsg($result);
	}
	
	public function getMessage()
	{
	    $page = yf_empty($_REQUEST['page'], 1, true);
	    $resume_list = Model('read')->getMessageList($page);
	    $this->assign('list', $resume_list['data']);
	    $this->assign('page', $resume_list['pagelink']);
	    $this->display('message_list.html');
	}
	
	public function hero()
	{
	    $page = yf_empty($_REQUEST['page'], 1, true);
	    $list = Model('read')->getApplyList($page);
	    $this->assign('result',$list['data']);
	    $this->assign('count',$list['count']);
	    $this->assign('list_page',$list['pagelink']);
	    $this->display('hero.html');
	}
	public function execlHero()
	{
	    $title = array("序号","姓名","年龄","性别","联系电话","武艺特长","演艺经历","昵称","openid");
	    $result =Model('read')->getApplyAll();
	    exportData("岭南英雄报名列表",$title,$result);
	    exit;
	}
	
	public function group()
	{
	    $page = yf_empty($_REQUEST['page'], 1, true);
	    $list = Model('read')->getGroupList($page);
	    $this->assign('result',$list['data']);
	    $this->assign('count',$list['count']);
	    $this->assign('list_page',$list['pagelink']);
	    $this->display('group.html');
	}
	
	public function execlGroup()
	{
	    $title = array("序号","姓名","联系电话","Ta的宣言","昵称","openid");
	    $result =Model('read')->getGroupAll();
	    exportData("群体通报名列表",$title,$result);
	    exit;
	}
	
	public function parlour()
	{
	    $page = yf_empty($_REQUEST['page'], 1, true);
	    $list = Model('read')->getParlourList($page);
	    $this->assign('result',$list['data']);
	    $this->assign('count',$list['count']);
	    $this->assign('list_page',$list['pagelink']);
	    $this->display('parlour.html');
	}
	
	public function execlParlour()
	{
	    $title = array("序号","姓名","年龄","性别","联系电话","公司","职务","昵称","openid");
	    $result =Model('read')->getParlourAll();
	    exportData("城市客厅报名列表",$title,$result);
	    exit;
	}
	
	public function child()
	{
	    $page = yf_empty($_REQUEST['page'], 1, true);
	    $list = Model('read')->getParlourList2($page);
	    $this->assign('result',$list['data']);
	    $this->assign('count',$list['count']);
	    $this->assign('list_page',$list['pagelink']);
	    $this->display('child.html');
	}
	
	public function execlParlour2()
	{
	    $title = array("序号","姓名","电话","单位","职务","邮箱","昵称","openid");
	    $result =Model('read')->getParlour2All();
	    exportData("儿童成长生态城市客厅报名列表",$title,$result);
	    exit;
	}
	
	public function comment()
	{
	     $total['startTime'] = yf_empty(strtotime($_GET['startTime']),"",true);
        $total['endTime'] = yf_empty(strtotime($_GET['endTime']),"",true);
        $total['nickname'] = yf_empty($_GET['nickname'],"",true);
        $total['comment'] = yf_empty($_GET['comment'],"",true);
        $total['status'] = yf_empty($_GET['status'],"all",true);
        $page=isset($_REQUEST['page'])?intval($_REQUEST['page']):1;
        $list=Model('read')->listComment($page,$total);
        $this->assign('list',$list['data']);
        $this->assign('list_page',$list['pagelink']);
        $this->assign('page',$page);
        $this->assign("total", $total);
        $this->display("comment_list.html");
	}
	
	public function addDigest()
	{
	    $id = isset($_POST['id'])?$_POST['id']:"";
	    $res = Model('read')->addDigest($id);
	    print_r(json_encode($res));
	}
	
	public function guangfu()
	{
	    $page = yf_empty($_REQUEST['page'], 1, true);
	    $list = Model('read')->getGuangfuList($page);
	    $this->assign('result',$list['data']);
	    $this->assign('count',$list['count']);
	    $this->assign('list_page',$list['pagelink']);
	    $this->display('guangfu.html');
	}
	
	public function execlGuangfu()
	{
	    $title = array("序号","姓名","电话","报名人数","昵称","openid");
	    $result =Model('read')->getGuangfuAll();
	    exportData("广府文化小使者报名列表",$title,$result);
	    exit;
	}
}